博客
关于我
强烈建议你试试无所不能的chatGPT,快点击我
磕代码:c/c++/java:输入年龄,输出活了多少秒
阅读量:83 次
发布时间:2019-02-26

本文共 734 字,大约阅读时间需要 2 分钟。

在这里插入图片描述

在这里插入图片描述
c:

#include
int main(){
long int age; /*scanf("%d",&age);*/ scanf("%ld",&age); long int b=31560000; /*printf("%d",age*b);*/ printf("%ld",age*b); /*%ld 的话2113 输出的字节要长点 %d 的要短点5261。比如,一个数大于32767 用%d 就要溢出4102。假1653如你想输出32768.用%d 就会输出-1.这就是溢出。但是用%ld 就不会。它能接受的数的范围大些!希望你懂了! 输出-32768~32767以内的数都一样!*/}

c++:

#include
using namespace std;int main(){
long long age; cin>>age; cout<

Java:

import java.io.*;public class Main{
public static void main(String[]args)throws IOException{
BufferedReader br=new BufferedReader (new InputStreamReader(System.in)); String age=br.readLine(); long a=Integer.parseInt(age); System.out.println(a*31560000); }}

转载地址:http://fyrk.baihongyu.com/

你可能感兴趣的文章